<template>
  <div>
    <a-table bordered :dataSource="dataSource" :columns="columns" :pagination="false">
      <template #bodyCell="{ column, text, record }">
        <template v-if="column.dataIndex === 'operation'">
          <a-popconfirm
            v-if="dataSource.length"
            title="是否确定需要提交?"
            @confirm="onDelete(record.id)"
          >
            <a>提交论文</a>
          </a-popconfirm>
        </template>
      </template>
    </a-table>
  </div>
</template>

<script setup>
const dataSource = [
  {
    id: "20222473",
    name: "论文一",
    teacher: "寒剑锋",
    courtyard: "否",
    status: "确定",
    guide: "亲关山",
    state: "待提交",
    operation: "",
  },
  {
    id: "20222472",
    name: "论文二",
    teacher: "寒剑锋",
    courtyard: "否",
    status: "确定",
    guide: "亲关山",
    state: "待提交",
    operation: "",
  },
];

const columns = [
  {
    title: "题目编号",
    dataIndex: "id",
    key: "id",
  },
  {
    title: "题目名称",
    dataIndex: "name",
    key: "name",
  },
  {
    title: "负责教师",
    dataIndex: "teacher",
    key: "teacher",
  },
  {
    title: "是否跨院系",
    dataIndex: "courtyard",
    key: "courtyard",
  },
  {
    title: "选题状态",
    dataIndex: "status",
    key: "status",
  },
  {
    title: "指导老师",
    dataIndex: "guide",
    key: "guide",
  },
  {
    title: "状态",
    dataIndex: "state",
    key: "state",
  },
  {
    title: "操作",
    dataIndex: "operation",
    key: "operation",
  },
];
const onDelete = (id) => {
  // console.log(id)
  // console.log(dataSource.value)
  // dataSource.value = dataSource.value.filter((item) => item.id !== id);
};
</script>

<style lang="scss" scoped></style>
